Mix feature flags into fingerprint/metadata shorthash
authorNipunn Koorapati <nipunn@dropbox.com>
Tue, 4 Oct 2016 23:16:30 +0000 (16:16 -0700)
committerNipunn Koorapati <nipunn1313@gmail.com>
Mon, 7 Nov 2016 09:17:56 +0000 (20:17 +1100)
Since building dependencies results in different libraries
depending on the feature flags, I added the feature flags
into the short_hash. This solves an issue when multiple crates
share a target directory or multiple targets share a common
library with divergent feature flag choice.

- Only link binaries, build scripts, and top level deps
- Handle dylibs differently (no metadata filename / linking)
- Fingerprint based on link_dst rather than file_stem.

This (sadly) limits the effects of dep caching to things
which don't produce a hard-link. Currently, this is only dependent
library crates. Stil a big win.

18 files changed:
src/cargo/core/manifest.rs
src/cargo/ops/cargo_clean.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/layout.rs
src/cargo/ops/cargo_rustc/mod.rs
tests/bench.rs
tests/build-script.rs
tests/build.rs
tests/clean.rs
tests/cross-compile.rs
tests/freshness.rs
tests/git.rs
tests/path.rs
tests/plugins.rs
tests/run.rs
tests/rustc.rs
tests/test.rs

index 4e693ff2b3f24a946c19df9db4d678c8c3b012f9..f5f4217da81da7d8f11ab228d00219a7599531a3 100644 (file)
@@ -395,6 +395,13 @@ impl Target {
         }
     }
 
+    pub fn is_dylib(&self) -> bool {
+        match self.kind {
+            TargetKind::Lib(ref libs) => libs.iter().any(|l| *l == LibKind::Dylib),
+            _ => false
+        }
+    }
+
     pub fn linkable(&self) -> bool {
         match self.kind {
             TargetKind::Lib(ref kinds) => {
index 6d544c19be24fc980662892d423094f8117ee7a9..738417a4bf83184603ea7bc9ead226282ba86855 100644 (file)
@@ -77,9 +77,11 @@ pub fn clean(ws: &Workspace, opts: &CleanOptions) -> CargoResult<()> {
         try!(rm_rf(&layout.proxy().fingerprint(&unit.pkg)));
         try!(rm_rf(&layout.build(&unit.pkg)));
 
-        let root = cx.out_dir(&unit);
-        for (filename, _) in try!(cx.target_filenames(&unit)) {
-            try!(rm_rf(&root.join(&filename)));
+        for (src, link_dst, _) in try!(cx.target_filenames(&unit)) {
+            try!(rm_rf(&src));
+            if let Some(dst) = link_dst {
+                try!(rm_rf(&dst));
+            }
         }
     }
 
index 4e0cf00db6af268a54c9906cdaa94e6d295e6501..9c4a34c48d4dcc06418020bacaa60c5958f4304f 100644 (file)
@@ -309,11 +309,41 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
 
     /// Get the metadata for a target in a specific profile
     pub fn target_metadata(&self, unit: &Unit) -> Option<Metadata> {
-        let metadata = unit.target.metadata();
+        // No metadata for dylibs because of a couple issues
+        // - OSX encodes the dylib name in the executable
+        // - Windows rustc multiple files of which we can't easily link all of them
+        if !unit.profile.test && unit.target.is_dylib() {
+            return None;
+        }
+
+        let metadata = unit.target.metadata().cloned().map(|mut m| {
+            if let Some(features) = self.resolve.features(unit.pkg.package_id()) {
+                let mut feat_vec: Vec<&String> = features.iter().collect();
+                feat_vec.sort();
+                for feat in feat_vec {
+                    m.mix(feat);
+                }
+            }
+            m.mix(unit.profile);
+            m
+        });
+        let mut pkg_metadata = {
+            let mut m = unit.pkg.generate_metadata();
+            if let Some(features) = self.resolve.features(unit.pkg.package_id()) {
+                let mut feat_vec: Vec<&String> = features.iter().collect();
+                feat_vec.sort();
+                for feat in feat_vec {
+                    m.mix(feat);
+                }
+            }
+            m.mix(unit.profile);
+            m
+        };
+
         if unit.target.is_lib() && unit.profile.test {
             // Libs and their tests are built in parallel, so we need to make
             // sure that their metadata is different.
-            metadata.cloned().map(|mut m| {
+            metadata.map(|mut m| {
                 m.mix(&"test");
                 m
             })
@@ -321,37 +351,13 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             // Make sure that the name of this test executable doesn't
             // conflict with a library that has the same name and is
             // being tested
-            let mut metadata = unit.pkg.generate_metadata();
-            metadata.mix(&format!("bin-{}", unit.target.name()));
-            Some(metadata)
+            pkg_metadata.mix(&format!("bin-{}", unit.target.name()));
+            Some(pkg_metadata)
         } else if unit.pkg.package_id().source_id().is_path() &&
                   !unit.profile.test {
-            // If we're not building a unit test but we're building a path
-            // dependency, then we're likely compiling the "current package" or
-            // some package in a workspace. In this situation we pass no
-            // metadata by default so we'll have predictable
-            // file names like `target/debug/libfoo.{a,so,rlib}` and such.
-            //
-            // Note, though, that the compiler's build system at least wants
-            // path dependencies to have hashes in filenames. To account for
-            // that we have an extra hack here which reads the
-            // `__CARGO_DEFAULT_METADATA` environment variable and creates a
-            // hash in the filename if that's present.
-            //
-            // This environment variable should not be relied on! It's basically
-            // just here for rustbuild. We need a more principled method of
-            // doing this eventually.
-            if unit.target.is_lib() {
-                env::var("__CARGO_DEFAULT_LIB_METADATA").ok().map(|meta| {
-                    let mut metadata = unit.pkg.generate_metadata();
-                    metadata.mix(&meta);
-                    metadata
-                })
-            } else {
-                None
-            }
+            Some(pkg_metadata)
         } else {
-            metadata.cloned()
+            metadata
         }
     }
 
@@ -360,19 +366,57 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         match self.target_metadata(unit) {
             Some(ref metadata) => format!("{}{}", unit.target.crate_name(),
                                           metadata.extra_filename),
-            None if unit.target.allows_underscores() => {
-                unit.target.name().to_string()
+            None => self.bin_stem(unit),
+        }
+    }
+
+    fn bin_stem(&self, unit: &Unit) -> String {
+        if unit.target.allows_underscores() {
+            unit.target.name().to_string()
+        } else {
+            unit.target.crate_name()
+        }
+    }
+
+    pub fn link_stem(&self, unit: &Unit) -> Option<(PathBuf, String)> {
+        let src_dir = self.out_dir(unit);
+        let bin_stem = self.bin_stem(unit);
+        let file_stem = self.file_stem(unit);
+
+        // We currently only lift files up from the `deps` directory. If
+        // it was compiled into something like `example/` or `doc/` then
+        // we don't want to link it up.
+        if src_dir.ends_with("deps") {
+            // Don't lift up library dependencies
+            if unit.pkg.package_id() != &self.current_package && !unit.target.is_bin() {
+                None
+            } else {
+                Some((
+                    src_dir.parent().unwrap().to_owned(),
+                    if unit.profile.test {file_stem} else {bin_stem},
+                ))
             }
-            None => unit.target.crate_name(),
+        } else if bin_stem == file_stem {
+            None
+        } else if src_dir.ends_with("examples") {
+            Some((src_dir, bin_stem))
+        } else if src_dir.parent().unwrap().ends_with("build") {
+            Some((src_dir, bin_stem))
+        } else {
+            None
         }
     }
 
     /// Return the filenames that the given target for the given profile will
-    /// generate, along with whether you can link against that file (e.g. it's a
-    /// library).
+    /// generate as a list of 3-tuples (filename, link_dst, linkable)
+    /// filename: filename rustc compiles to. (Often has metadata suffix).
+    /// link_dst: Optional file to link/copy the result to (without metadata suffix)
+    /// linkable: Whether possible to link against file (eg it's a library)
     pub fn target_filenames(&self, unit: &Unit)
-                            -> CargoResult<Vec<(String, bool)>> {
+                            -> CargoResult<Vec<(PathBuf, Option<PathBuf>, bool)>> {
+        let out_dir = self.out_dir(unit);
         let stem = self.file_stem(unit);
+        let link_stem = self.link_stem(unit);
         let info = if unit.target.for_host() {
             &self.host_info
         } else {
@@ -386,8 +430,11 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 let crate_type = if crate_type == "lib" {"rlib"} else {crate_type};
                 match info.crate_types.get(crate_type) {
                     Some(&Some((ref prefix, ref suffix))) => {
-                        ret.push((format!("{}{}{}", prefix, stem, suffix),
-                                  linkable));
+                        let filename = out_dir.join(format!("{}{}{}", prefix, stem, suffix));
+                        let link_dst = link_stem.clone().map(|(ld, ls)| {
+                            ld.join(format!("{}{}{}", prefix, ls, suffix))
+                        });
+                        ret.push((filename, link_dst, linkable));
                         Ok(())
                     }
                     // not supported, don't worry about it
@@ -429,6 +476,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                    support any of the output crate types",
                   unit.pkg, self.target_triple());
         }
+        info!("Target filenames: {:?}", ret);
         Ok(ret)
     }
 
index b16cf7f90df4651bb7f94070e8d5682bececf37d..a5d3e53e14ad99707effb40475d1edfe79c54c75 100644 (file)
@@ -49,7 +49,7 @@ pub fn prepare_target<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
     let _p = profile::start(format!("fingerprint: {} / {}",
                                     unit.pkg.package_id(), unit.target.name()));
     let new = dir(cx, unit);
-    let loc = new.join(&filename(unit));
+    let loc = new.join(&filename(cx, unit));
 
     debug!("fingerprint at: {}", loc.display());
 
@@ -82,8 +82,11 @@ pub fn prepare_target<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
         missing_outputs = !root.join(unit.target.crate_name())
                                .join("index.html").exists();
     } else {
-        for (filename, _) in try!(cx.target_filenames(unit)) {
-            missing_outputs |= fs::metadata(root.join(filename)).is_err();
+        for (src, link_dst, _) in try!(cx.target_filenames(unit)) {
+            missing_outputs |= fs::metadata(&src).is_err();
+            if let Some(link_dst) = link_dst {
+                missing_outputs |= fs::metadata(link_dst).is_err();
+            }
         }
     }
 
@@ -529,7 +532,7 @@ pub fn dir(cx: &Context, unit: &Unit) -> PathBuf {
 
 /// Returns the (old, new) location for the dep info file of a target.
 pub fn dep_info_loc(cx: &Context, unit: &Unit) -> PathBuf {
-    dir(cx, unit).join(&format!("dep-{}", filename(unit)))
+    dir(cx, unit).join(&format!("dep-{}", filename(cx, unit)))
 }
 
 fn compare_old_fingerprint(loc: &Path, new_fingerprint: &Fingerprint)
@@ -650,7 +653,13 @@ fn mtime_if_fresh<I>(output: &Path, paths: I) -> Option<FileTime>
     }
 }
 
-fn filename(unit: &Unit) -> String {
+fn filename(cx: &Context, unit: &Unit) -> String {
+    // If there exists a link stem, we have to use that since multiple target filenames
+    // may hardlink to the same target stem. If there's no link, we can use the original
+    // file_stem (which can include a suffix)
+    let file_stem = cx.link_stem(unit)
+        .map(|(_path, stem)| stem)
+        .unwrap_or_else(|| cx.file_stem(unit));
     let kind = match *unit.target.kind() {
         TargetKind::Lib(..) => "lib",
         TargetKind::Bin => "bin",
@@ -666,7 +675,7 @@ fn filename(unit: &Unit) -> String {
     } else {
         ""
     };
-    format!("{}{}-{}", flavor, kind, unit.target.name())
+    format!("{}{}-{}", flavor, kind, file_stem)
 }
 
 // The dep-info files emitted by the compiler all have their listed paths
index 18ae026e19396d1447ca38e643d50b7402179754..0c7723f401d2ca94a58b95fc1e7662e47df5a465 100644 (file)
@@ -175,7 +175,7 @@ impl<'a> LayoutProxy<'a> {
         } else if unit.target.is_lib() {
             self.deps().to_path_buf()
         } else {
-            self.root().to_path_buf()
+            self.deps().to_path_buf()
         }
     }
 
index 6db0bb6f35e34fc02492035a1479cf0aab5aea0a..82014c493238b9d394371937adef0dc655168d6a 100644 (file)
@@ -110,14 +110,18 @@ pub fn compile_targets<'a, 'cfg: 'a>(ws: &Workspace<'cfg>,
           .or_insert(Vec::new())
           .push(("OUT_DIR".to_string(), out_dir));
 
-        for (filename, _linkable) in try!(cx.target_filenames(unit)) {
-            let dst = cx.out_dir(unit).join(filename);
+        for (dst, link_dst, _linkable) in try!(cx.target_filenames(unit)) {
+            let bindst = match link_dst {
+                Some(link_dst) => link_dst,
+                None => dst.clone(),
+            };
+
             if unit.profile.test {
                 cx.compilation.tests.push((unit.pkg.clone(),
                                            unit.target.name().to_string(),
                                            dst));
             } else if unit.target.is_bin() || unit.target.is_example() {
-                cx.compilation.binaries.push(dst);
+                cx.compilation.binaries.push(bindst);
             } else if unit.target.is_lib() {
                 let pkgid = unit.pkg.package_id().clone();
                 cx.compilation.libraries.entry(pkgid).or_insert(Vec::new())
@@ -135,8 +139,8 @@ pub fn compile_targets<'a, 'cfg: 'a>(ws: &Workspace<'cfg>,
                 }
 
                 let v = try!(cx.target_filenames(unit));
-                let v = v.into_iter().map(|(f, _)| {
-                    (unit.target.clone(), cx.out_dir(unit).join(f))
+                let v = v.into_iter().map(|(f, _, _)| {
+                    (unit.target.clone(), f)
                 }).collect::<Vec<_>>();
                 cx.compilation.libraries.insert(pkgid.clone(), v);
             }
@@ -228,9 +232,9 @@ fn rustc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
     let do_rename = unit.target.allows_underscores() && !unit.profile.test;
     let real_name = unit.target.name().to_string();
     let crate_name = unit.target.crate_name();
-    let move_outputs_up = unit.pkg.package_id() == &cx.current_package;
 
-    let rustc_dep_info_loc = if do_rename {
+    // XXX(Rely on target_filenames iterator as source of truth rather than rederiving filestem)
+    let rustc_dep_info_loc = if do_rename && cx.target_metadata(unit).is_none() {
         root.join(&crate_name)
     } else {
         root.join(&cx.file_stem(unit))
@@ -257,8 +261,7 @@ fn rustc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
 
         // FIXME(rust-lang/rust#18913): we probably shouldn't have to do
         //                              this manually
-        for &(ref filename, _linkable) in filenames.iter() {
-            let dst = root.join(filename);
+        for &(ref dst, ref _link_dst, _linkable) in filenames.iter() {
             if fs::metadata(&dst).is_ok() {
                 try!(fs::remove_file(&dst).chain_error(|| {
                     human(format!("Could not remove file: {}.", dst.display()))
@@ -295,7 +298,7 @@ fn rustc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
         }));
 
         if do_rename && real_name != crate_name {
-            let dst = root.join(&filenames[0].0);
+            let dst = &filenames[0].0;
             let src = dst.with_file_name(dst.file_name().unwrap()
                                             .to_str().unwrap()
                                             .replace(&real_name, &crate_name));
@@ -307,6 +310,7 @@ fn rustc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
         }
 
         if !has_custom_args || fs::metadata(&rustc_dep_info_loc).is_ok() {
+            info!("Renaming dep_info {:?} to {:?}", rustc_dep_info_loc, dep_info_loc);
             try!(fs::rename(&rustc_dep_info_loc, &dep_info_loc).chain_error(|| {
                 internal(format!("could not rename dep info: {:?}",
                               rustc_dep_info_loc))
@@ -318,36 +322,30 @@ fn rustc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
         // hard link our outputs out of the `deps` directory into the directory
         // above. This means that `cargo build` will produce binaries in
         // `target/debug` which one probably expects.
-        if move_outputs_up {
-            for &(ref filename, _linkable) in filenames.iter() {
-                let src = root.join(filename);
-                // This may have been a `cargo rustc` command which changes the
-                // output, so the source may not actually exist.
-                if !src.exists() {
-                    continue
-                }
+        for (src, link_dst, _linkable) in filenames {
+            // This may have been a `cargo rustc` command which changes the
+            // output, so the source may not actually exist.
+            debug!("Thinking about linking {} to {:?}", src.display(), link_dst);
+            if !src.exists() || link_dst.is_none() {
+                continue
+            }
+            let dst = link_dst.unwrap();
 
-                // We currently only lift files up from the `deps` directory. If
-                // it was compiled into something like `example/` or `doc/` then
-                // we don't want to link it up.
-                let src_dir = src.parent().unwrap();
-                if !src_dir.ends_with("deps") {
-                    continue
-                }
-                let dst = src_dir.parent().unwrap()
-                                 .join(src.file_name().unwrap());
-                if dst.exists() {
-                    try!(fs::remove_file(&dst).chain_error(|| {
-                        human(format!("failed to remove: {}", dst.display()))
-                    }));
-                }
-                try!(fs::hard_link(&src, &dst)
-                     .or_else(|_| fs::copy(&src, &dst).map(|_| ()))
-                     .chain_error(|| {
-                         human(format!("failed to link or copy `{}` to `{}`",
-                                       src.display(), dst.display()))
+            debug!("linking {} to {}", src.display(), dst.display());
+            if dst.exists() {
+                try!(fs::remove_file(&dst).chain_error(|| {
+                    human(format!("failed to remove: {}", dst.display()))
                 }));
             }
+            try!(fs::hard_link(&src, &dst)
+                 .or_else(|err| {
+                     debug!("hard link failed {}. falling back to fs::copy", err);
+                     fs::copy(&src, &dst).map(|_| ())
+                 })
+                 .chain_error(|| {
+                     human(format!("failed to link or copy `{}` to `{}`",
+                                   src.display(), dst.display()))
+            }));
         }
 
         Ok(())
@@ -658,7 +656,7 @@ fn build_deps_args(cmd: &mut ProcessBuilder, cx: &Context, unit: &Unit)
 
     fn link_to(cmd: &mut ProcessBuilder, cx: &Context, unit: &Unit)
                -> CargoResult<()> {
-        for (filename, linkable) in try!(cx.target_filenames(unit)) {
+        for (dst, _link_dst, linkable) in try!(cx.target_filenames(unit)) {
             if !linkable {
                 continue
             }
@@ -667,7 +665,7 @@ fn build_deps_args(cmd: &mut ProcessBuilder, cx: &Context, unit: &Unit)
             v.push("=");
             v.push(cx.out_dir(unit));
             v.push(&path::MAIN_SEPARATOR.to_string());
-            v.push(&filename);
+            v.push(&dst.file_name().unwrap());
             cmd.arg("--extern").arg(&v);
         }
         Ok(())
index 7048c57890faae9aa3a409461370e79969e7b93d..fdaa7160a5f6cb04483ef214ce0281b2ac4a8abc 100644 (file)
@@ -43,7 +43,7 @@ fn cargo_bench_simple() {
                 execs().with_stderr(&format!("\
 [COMPILING] foo v0.5.0 ({})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]foo-[..][EXE]", p.url()))
+[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
 test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
@@ -78,7 +78,7 @@ fn bench_tarname() {
                .with_stderr(format!("\
 [COMPILING] foo v0.0.1 ({dir})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]bin2-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]bin2-[..][EXE]
 ", dir = prj.url()))
                .with_stdout("
 running 1 test
@@ -107,7 +107,7 @@ fn cargo_bench_verbose() {
 [COMPILING] foo v0.5.0 ({url})
 [RUNNING] `rustc src[/]foo.rs [..]`
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] `[..]target[/]release[/]foo-[..][EXE] hello --bench`", url = p.url()))
+[RUNNING] `[..]target[/]release[/]deps[/]foo-[..][EXE] hello --bench`", url = p.url()))
                        .with_stdout("
 running 1 test
 test bench_hello ... bench: [..] 0 ns/iter (+/- 0)
@@ -190,7 +190,7 @@ test bench_hello ... ")
                        .with_stderr_contains(format!("\
 [COMPILING] foo v0.5.0 ({})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]foo-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]
 thread '[..]' panicked at 'assertion failed: \
     `(left == right)` (left: \
     `\"hello\"`, right: `\"nope\"`)', src[/]foo.rs:14
@@ -243,7 +243,7 @@ fn bench_with_lib_dep() {
                 execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]baz-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]baz-[..][EXE]
 [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
@@ -353,7 +353,7 @@ fn external_bench_explicit() {
                 execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]bench-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]bench-[..][EXE]
 [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
@@ -403,7 +403,7 @@ fn external_bench_implicit() {
                 execs().with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]external-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]external-[..][EXE]
 [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
@@ -547,7 +547,7 @@ fn lib_bin_same_name() {
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] release [optimized] target(s) in [..]
 [RUNNING] target[/]release[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]release[/]foo-[..][EXE]", p.url()))
+[RUNNING] target[/]release[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
 test [..] ... bench: [..] 0 ns/iter (+/- 0)
@@ -600,7 +600,7 @@ fn lib_with_standard_name() {
                        .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]bench-[..][EXE]
+[RUNNING] target[/]release[/]deps[/]bench-[..][EXE]
 [RUNNING] target[/]release[/]deps[/]syntax-[..][EXE]", dir = p.url()))
                        .with_stdout("
 running 1 test
@@ -652,7 +652,7 @@ fn lib_with_standard_name2() {
                        .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] target[/]release[/]syntax-[..][EXE]", dir = p.url()))
+[RUNNING] target[/]release[/]deps[/]syntax-[..][EXE]", dir = p.url()))
                        .with_stdout("
 running 1 test
 test bench ... bench: [..] 0 ns/iter (+/- 0)
@@ -722,7 +722,7 @@ fn bench_dylib() {
 [RUNNING] [..] -C opt-level=3 [..]
 [RUNNING] [..] -C opt-level=3 [..]
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] `[..]target[/]release[/]bench-[..][EXE] --bench`
+[RUNNING] `[..]target[/]release[/]deps[/]bench-[..][EXE] --bench`
 [RUNNING] `[..]target[/]release[/]deps[/]foo-[..][EXE] --bench`", dir = p.url()))
                        .with_stdout("
 running 1 test
@@ -744,7 +744,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
 [FRESH] bar v0.0.1 ({dir}/bar)
 [FRESH] foo v0.0.1 ({dir})
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] `[..]target[/]release[/]bench-[..][EXE] --bench`
+[RUNNING] `[..]target[/]release[/]deps[/]bench-[..][EXE] --bench`
 [RUNNING] `[..]target[/]release[/]deps[/]foo-[..][EXE] --bench`", dir = p.url()))
                        .with_stdout("
 running 1 test
@@ -871,7 +871,7 @@ fn bench_with_examples() {
 [RUNNING] `rustc [..]`
 [RUNNING] `rustc [..]`
 [FINISHED] release [optimized] target(s) in [..]
-[RUNNING] `{dir}[/]target[/]release[/]testb1-[..][EXE] --bench`
+[RUNNING] `{dir}[/]target[/]release[/]deps[/]testb1-[..][EXE] --bench`
 [RUNNING] `{dir}[/]target[/]release[/]deps[/]testbench-[..][EXE] --bench`",
                 dir = p.root().display(), url = p.url()))
                        .with_stdout("
@@ -920,7 +920,7 @@ fn test_a_bench() {
                        .with_stderr("\
 [COMPILING] foo v0.1.0 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]b-[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]b-[..][EXE]")
                        .with_stdout("
 running 1 test
 test foo ... ok
index 53c359f22e698b1aa61469e9330a4638047a9a76..e6bcef0fbe98b3e5bef14fef1b0236b2a5b69d66 100644 (file)
@@ -1141,7 +1141,8 @@ fn build_script_with_dynamic_native_dependency() {
             #[no_mangle]
             pub extern fn foo() {}
         "#);
-    assert_that(build.cargo_process("build"),
+    assert_that(build.cargo_process("build").arg("-v")
+                .env("RUST_LOG", "cargo::ops::cargo_rustc"),
                 execs().with_status(0));
 
     let foo = project("foo")
@@ -1186,7 +1187,8 @@ fn build_script_with_dynamic_native_dependency() {
             }
         "#);
 
-    assert_that(foo.cargo_process("build").env("SRC", build.root()),
+    assert_that(foo.cargo_process("build").arg("-v").env("SRC", build.root())
+                .env("RUST_LOG", "cargo::ops::cargo_rustc"),
                 execs().with_status(0));
 }
 
index 2bf78d7ba7c3940d251618700f56d25ae966a8b8..ac274de22a64788f92fa95ba9f91a72f3e7fcf23 100644 (file)
@@ -1055,7 +1055,7 @@ fn lto_build() {
         -C opt-level=3 \
         -C lto \
         -C metadata=[..] \
-        --out-dir {dir}[/]target[/]release \
+        --out-dir {dir}[/]target[/]release[/]deps \
         --emit=dep-info,link \
         -L dependency={dir}[/]target[/]release[/]deps`
 [FINISHED] release [optimized] target(s) in [..]
@@ -1789,6 +1789,7 @@ fn example_bin_same_name() {
         .unwrap();
 
     assert_that(&p.bin("foo"), is_not(existing_file()));
+    // We expect a file of the form bin/foo-{metadata_hash}
     assert_that(&p.bin("examples/foo"), existing_file());
 
     p.cargo("test").arg("--no-run").arg("-v")
@@ -1796,6 +1797,7 @@ fn example_bin_same_name() {
                    .unwrap();
 
     assert_that(&p.bin("foo"), is_not(existing_file()));
+    // We expect a file of the form bin/foo-{metadata_hash}
     assert_that(&p.bin("examples/foo"), existing_file());
 }
 
@@ -2162,9 +2164,9 @@ fn build_multiple_packages() {
     assert_that(process(&p.bin("foo")),
                 execs().with_stdout("i am foo\n"));
 
-    let d1_path = &p.build_dir().join("debug").join("deps")
+    let d1_path = &p.build_dir().join("debug")
                                 .join(format!("d1{}", env::consts::EXE_SUFFIX));
-    let d2_path = &p.build_dir().join("debug").join("deps")
+    let d2_path = &p.build_dir().join("debug")
                                 .join(format!("d2{}", env::consts::EXE_SUFFIX));
 
     assert_that(d1_path, existing_file());
index 59170ed708bd1627e6290d3acc1e3d402dd6abbe..39cc528720353420003399b34dc09b37d102e512 100644 (file)
@@ -80,9 +80,9 @@ fn clean_multiple_packages() {
                                         .arg("-p").arg("foo"),
                 execs().with_status(0));
 
-    let d1_path = &p.build_dir().join("debug").join("deps")
+    let d1_path = &p.build_dir().join("debug")
                                 .join(format!("d1{}", env::consts::EXE_SUFFIX));
-    let d2_path = &p.build_dir().join("debug").join("deps")
+    let d2_path = &p.build_dir().join("debug")
                                 .join(format!("d2{}", env::consts::EXE_SUFFIX));
 
 
index d5db56352638e3d036dd7daeeb21105679e024b4..bbb534f8d3dd4a793bc9ce50cd1143221c6828b2 100644 (file)
@@ -359,7 +359,7 @@ fn linker_and_ar() {
 [COMPILING] foo v0.5.0 ({url})
 [RUNNING] `rustc src[/]foo.rs --crate-name foo --crate-type bin -g \
     -C metadata=[..] \
-    --out-dir {dir}[/]target[/]{target}[/]debug \
+    --out-dir {dir}[/]target[/]{target}[/]debug[/]deps \
     --emit=dep-info,link \
     --target {target} \
     -C ar=my-ar-tool -C linker=my-linker-tool \
@@ -473,7 +473,7 @@ fn cross_tests() {
                        .with_stderr(&format!("\
 [COMPILING] foo v0.0.0 ({foo})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]{triple}[/]debug[/]bar-[..][EXE]
+[RUNNING] target[/]{triple}[/]debug[/]deps[/]bar-[..][EXE]
 [RUNNING] target[/]{triple}[/]debug[/]deps[/]foo-[..][EXE]", foo = p.url(), triple = target))
                        .with_stdout("
 running 1 test
index 49ab26a8c7cf410627dd0eaece6418ab33267747..786aef2227559541ce051d17df290cb7bc4dec34 100644 (file)
@@ -172,11 +172,17 @@ fn changing_lib_features_caches_targets() {
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 "));
 
-    /* Targets should be cached from the first build */
+    /* Targets should be cached from the first build
+       XXX Sadly these cannot be cached since the "symlink" step is
+           not separate from the "compile" step. Packages which link
+           to top level binaries eg (deps/foo-abc123 -> foo) are forced
+           to do an extra recompile here.
+    */
 
     assert_that(p.cargo("build"),
                 execs().with_status(0)
                        .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 "));
 
@@ -187,13 +193,71 @@ fn changing_lib_features_caches_targets() {
     assert_that(p.cargo("build").arg("--features").arg("foo"),
                 execs().with_status(0)
                        .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 "));
 }
 
+#[test]
+fn changing_profiles_caches_targets() {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [package]
+            name = "foo"
+            authors = []
+            version = "0.0.1"
+
+            [profile.dev]
+            panic = "abort"
+
+            [profile.test]
+            panic = "unwind"
+        "#)
+        .file("src/lib.rs", "");
+
+    assert_that(p.cargo_process("build"),
+                execs().with_status(0)
+                       .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
+[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+"));
+
+    assert_that(p.cargo("test"),
+                execs().with_status(0)
+                       .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
+[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] target[..]debug[..]deps[..]foo-[..][EXE]
+[DOCTEST] foo
+"));
+
+    /* Targets should be cached from the first build
+       XXX Sadly these cannot be cached since the "symlink" step is
+           not separate from the "compile" step. Packages which link
+           to top level binaries eg (deps/foo-abc123 -> foo) are forced
+           to do an extra recompile here.
+    */
+
+    assert_that(p.cargo("build"),
+                execs().with_status(0)
+                       .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
+[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+"));
+
+    assert_that(p.cargo("test").arg("foo"),
+                execs().with_status(0)
+                       .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
+[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] target[..]debug[..]deps[..]foo-[..][EXE]
+[DOCTEST] foo
+"));
+}
+
 #[test]
 fn changing_bin_paths_common_target_features_caches_targets() {
-    /// Make sure dep_cache crate is built once per feature
+    // Make sure dep_cache crate is built once per feature
     let p = project("foo")
         .file(".cargo/config", r#"
             [build]
@@ -261,7 +325,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
 [..]Compiling dep_crate v0.0.1 ([..])
 [..]Compiling a v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/a`
+[RUNNING] `[..]target[/]debug[/]a[EXE]`
 "));
     assert_that(p.cargo("clean").arg("-p").arg("a").cwd(p.root().join("a")),
                 execs().with_status(0));
@@ -271,7 +335,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
                        .with_stderr("\
 [..]Compiling a v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/a`
+[RUNNING] `[..]target[/]debug[/]a[EXE]`
 "));
 
     /* Build and rebuild b/. Ensure dep_crate only builds once */
@@ -282,7 +346,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
 [..]Compiling dep_crate v0.0.1 ([..])
 [..]Compiling b v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/b`
+[RUNNING] `[..]target[/]debug[/]b[EXE]`
 "));
     assert_that(p.cargo("clean").arg("-p").arg("b").cwd(p.root().join("b")),
                 execs().with_status(0));
@@ -292,7 +356,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
                        .with_stderr("\
 [..]Compiling b v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/b`
+[RUNNING] `[..]target[/]debug[/]b[EXE]`
 "));
 
     /* Build a/ package again. If we cache different feature dep builds correctly,
@@ -305,7 +369,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
                        .with_stderr("\
 [..]Compiling a v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/a`
+[RUNNING] `[..]target[/]debug[/]a[EXE]`
 "));
 
     /* Build b/ package again. If we cache different feature dep builds correctly,
@@ -318,7 +382,7 @@ fn changing_bin_paths_common_target_features_caches_targets() {
                        .with_stderr("\
 [..]Compiling b v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target/debug/b`
+[RUNNING] `[..]target[/]debug[/]b[EXE]`
 "));
 }
 
@@ -334,38 +398,54 @@ fn changing_bin_features_caches_targets() {
             [features]
             foo = []
         "#)
-        .file("src/main.rs", "fn main() {}");
+        .file("src/main.rs", r#"
+            fn main() {
+                let msg = if cfg!(feature = "foo") { "feature on" } else { "feature off" };
+                println!("{}", msg);
+            }
+        "#);
 
-    assert_that(p.cargo_process("build"),
+    assert_that(p.cargo_process("run"),
                 execs().with_status(0)
+                       .with_stdout("feature off")
                        .with_stderr("\
 [..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] `target[/]debug[/]foo[EXE]`
 "));
 
-    assert_that(p.cargo("build").arg("--features").arg("foo"),
+    assert_that(p.cargo("run").arg("--features").arg("foo"),
                 execs().with_status(0)
+                       .with_stdout("feature on")
                        .with_stderr("\
 [..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] `target[/]debug[/]foo[EXE]`
 "));
 
-    /* Targets should be cached from the first build */
+    /* Targets should be cached from the first build
+       XXX Sadly these cannot be cached since the "symlink" step is
+           not separate from the "compile" step. Packages which link
+           to top level binaries eg (deps/foo-abc123 -> foo) are forced
+           to do an extra recompile here.
+    */
 
-    assert_that(p.cargo("build"),
+    assert_that(p.cargo("run"),
                 execs().with_status(0)
+                       .with_stdout("feature off")
                        .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] `target[/]debug[/]foo[EXE]`
 "));
 
-    assert_that(p.cargo("build"),
-                execs().with_status(0)
-                       .with_stdout(""));
-
-    assert_that(p.cargo("build").arg("--features").arg("foo"),
+    assert_that(p.cargo("run").arg("--features").arg("foo"),
                 execs().with_status(0)
+                       .with_stdout("feature on")
                        .with_stderr("\
+[..]Compiling foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
+[RUNNING] `target[/]debug[/]foo[EXE]`
 "));
 }
 
index 02c42b3ff7fedd40131971092d3e323e04f58f92..c60076f62f4793a53c508705aa73154e6eff8081 100644 (file)
@@ -1035,7 +1035,7 @@ fn dev_deps_with_testing() {
 [COMPILING] [..] v0.5.0 ([..])
 [COMPILING] [..] v0.5.0 ([..]
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]foo-[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]")
                        .with_stdout("
 running 1 test
 test tests::foo ... ok
index b9c89b1d10e7dc8b04ec23b8b6e38604f04fe819..7d057ae75b62022e726e27cf996909efeb14a9ba 100644 (file)
@@ -189,7 +189,7 @@ fn cargo_compile_with_root_dev_deps_with_testing() {
 [COMPILING] [..] v0.5.0 ([..])
 [COMPILING] [..] v0.5.0 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]foo-[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]")
                        .with_stdout("
 running 0 tests
 
index cd762377ab946c3b3d2c42810c574230ee32f96c..8ad26ba3678d5077508145a453b3d8b9985efab2 100644 (file)
@@ -147,8 +147,7 @@ fn plugin_with_dynamic_native_dependency() {
 
             fn main() {
                 let src = PathBuf::from(env::var("SRC").unwrap());
-                println!("cargo:rustc-flags=-L {}/deps", src.parent().unwrap()
-                                                       .display());
+                println!("cargo:rustc-flags=-L {}/deps", src.parent().unwrap().display());
             }
         "#)
         .file("bar/src/lib.rs", r#"
index 1460761386659d6c4c4b1c5ece5c5d8fd4d25280..ce007bef645e14ce43a9d8e2c68542b52b5e7595 100644 (file)
@@ -429,7 +429,7 @@ fn example_with_release_flag() {
         --out-dir {dir}[/]target[/]release[/]examples \
         --emit=dep-info,link \
         -L dependency={dir}[/]target[/]release[/]deps \
-         --extern bar={dir}[/]target[/]release[/]deps[/]libbar.rlib`
+         --extern bar={dir}[/]target[/]release[/]deps[/]libbar-[..].rlib`
 [FINISHED] release [optimized] target(s) in [..]
 [RUNNING] `target[/]release[/]examples[/]a[EXE]`
 ",
@@ -457,7 +457,7 @@ fast2"));
         --out-dir {dir}[/]target[/]debug[/]examples \
         --emit=dep-info,link \
         -L dependency={dir}[/]target[/]debug[/]deps \
-         --extern bar={dir}[/]target[/]debug[/]deps[/]libbar.rlib`
+         --extern bar={dir}[/]target[/]debug[/]deps[/]libbar-[..].rlib`
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] `target[/]debug[/]examples[/]a[EXE]`
 ",
index 5e54bae5a6edb5c6d5e1a0ebc40b37497cb475f9..b8475e16f4414c4551f8982c9cce494208d5f49d 100644 (file)
@@ -97,7 +97,7 @@ fn build_main_and_allow_unstable_options() {
         --out-dir [..] \
         --emit=dep-info,link \
         -L dependency={dir}[/]target[/]debug[/]deps \
-        --extern {name}={dir}[/]target[/]debug[/]deps[/]lib{name}.rlib`
+        --extern {name}={dir}[/]target[/]debug[/]deps[/]lib{name}-[..].rlib`
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 ",
             dir = p.root().display(), url = p.url(),
index b3ca52f8ce918aefad93e2bb939b2865fb7aa8f2..a9f78b2be40bbe3b9e652e9207729f2c35b7b0ea 100644 (file)
@@ -40,7 +40,7 @@ fn cargo_test_simple() {
                 execs().with_stderr(format!("\
 [COMPILING] foo v0.5.0 ({})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]foo-[..][EXE]", p.url()))
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]", p.url()))
                        .with_stdout("
 running 1 test
 test test_hello ... ok
@@ -93,7 +93,7 @@ fn cargo_test_release() {
 [RUNNING] [..] -C opt-level=3 [..]
 [FINISHED] release [optimized] target(s) in [..]
 [RUNNING] `[..]target[/]release[/]deps[/]foo-[..][EXE]`
-[RUNNING] `[..]target[/]release[/]test-[..][EXE]`
+[RUNNING] `[..]target[/]release[/]deps[/]test-[..][EXE]`
 [DOCTEST] foo
 [RUNNING] `rustdoc --test [..]lib.rs[..]`", dir = p.url()))
                        .with_stdout("
@@ -130,7 +130,7 @@ fn cargo_test_verbose() {
 [COMPILING] foo v0.5.0 ({url})
 [RUNNING] `rustc src[/]foo.rs [..]`
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] `[..]target[/]debug[/]foo-[..][EXE] hello`", url = p.url()))
+[RUNNING] `[..]target[/]debug[/]deps[/]foo-[..][EXE] hello`", url = p.url()))
                        .with_stdout("
 running 1 test
 test test_hello ... ok
@@ -198,7 +198,7 @@ fn cargo_test_failing_test() {
                 execs().with_stderr(format!("\
 [COMPILING] foo v0.5.0 ({url})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]foo-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
 [ERROR] test failed", url = p.url()))
                        .with_stdout_contains("
 running 1 test
@@ -258,7 +258,7 @@ fn test_with_lib_dep() {
                 execs().with_stderr(format!("\
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]baz-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]baz-[..][EXE]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
 [DOCTEST] foo", p.url()))
                        .with_stdout("
@@ -375,7 +375,7 @@ fn external_test_explicit() {
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]debug[/]test-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]test-[..][EXE]
 [DOCTEST] foo", p.url()))
                        .with_stdout("
 running 1 test
@@ -423,7 +423,7 @@ fn external_test_implicit() {
                 execs().with_stderr(format!("\
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]external-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]external-[..][EXE]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
 [DOCTEST] foo", p.url()))
                        .with_stdout("
@@ -568,7 +568,7 @@ fn lib_bin_same_name() {
 [COMPILING] foo v0.0.1 ({})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]debug[/]foo-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
 [DOCTEST] foo", p.url()))
                        .with_stdout("
 running 1 test
@@ -621,7 +621,7 @@ fn lib_with_standard_name() {
 [COMPILING] syntax v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]syntax-[..][EXE]
-[RUNNING] target[/]debug[/]test-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]test-[..][EXE]
 [DOCTEST] syntax", dir = p.url()))
                        .with_stdout("
 running 1 test
@@ -675,7 +675,7 @@ fn lib_with_standard_name2() {
                        .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]syntax-[..][EXE]", dir = p.url()))
+[RUNNING] target[/]debug[/]deps[/]syntax-[..][EXE]", dir = p.url()))
                        .with_stdout("
 running 1 test
 test test ... ok
@@ -715,7 +715,7 @@ fn lib_without_name() {
                        .with_stderr(&format!("\
 [COMPILING] syntax v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]syntax-[..][EXE]", dir = p.url()))
+[RUNNING] target[/]debug[/]deps[/]syntax-[..][EXE]", dir = p.url()))
                        .with_stdout("
 running 1 test
 test test ... ok
@@ -974,7 +974,7 @@ fn test_dylib() {
 [COMPILING] foo v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]debug[/]test-[..][EXE]", dir = p.url()))
+[RUNNING] target[/]debug[/]deps[/]test-[..][EXE]", dir = p.url()))
                        .with_stdout("
 running 1 test
 test foo ... ok
@@ -994,7 +994,7 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
                        .with_stderr("\
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]debug[/]test-[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]test-[..][EXE]")
                        .with_stdout("
 running 1 test
 test foo ... ok
@@ -1154,7 +1154,7 @@ fn test_run_specific_bin_target() {
                        .with_stderr(format!("\
 [COMPILING] foo v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]bin2-[..][EXE]", dir = prj.url()))
+[RUNNING] target[/]debug[/]deps[/]bin2-[..][EXE]", dir = prj.url()))
                        .with_stdout("
 running 1 test
 test test2 ... ok
@@ -1183,7 +1183,7 @@ fn test_run_specific_test_target() {
                        .with_stderr(format!("\
 [COMPILING] foo v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]b-[..][EXE]", dir = prj.url()))
+[RUNNING] target[/]debug[/]deps[/]b-[..][EXE]", dir = prj.url()))
                        .with_stdout("
 running 1 test
 test test_b ... ok
@@ -1219,7 +1219,7 @@ fn test_no_harness() {
                        .with_stderr(&format!("\
 [COMPILING] foo v0.0.1 ({dir})
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]bar-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]bar-[..][EXE]
 ",
                        dir = p.url())));
 }
@@ -1746,7 +1746,7 @@ fn filter_no_doc_tests() {
                 execs().with_stderr("\
 [COMPILING] foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
-[RUNNING] target[/]debug[/]foo[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]foo[..][EXE]")
                        .with_stdout("
 running 0 tests
 
@@ -1944,7 +1944,7 @@ fn no_fail_fast() {
 [COMPILING] foo v0.0.1 ([..])
 [FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] target[/]debug[/]deps[/]foo-[..][EXE]
-[RUNNING] target[/]debug[/]test_add_one-[..][EXE]")
+[RUNNING] target[/]debug[/]deps[/]test_add_one-[..][EXE]")
                        .with_stdout_contains("
 running 0 tests
 
@@ -1952,7 +1952,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 
 ")
                        .with_stderr_contains("\
-[RUNNING] target[/]debug[/]test_sub_one-[..][EXE]
+[RUNNING] target[/]debug[/]deps[/]test_sub_one-[..][EXE]
 [DOCTEST] foo")
                        .with_stdout_contains("\
 test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured